package org.springblade.modules.admin.service;

import org.springblade.core.mp.base.BaseService;
import org.springblade.flow.repair.parts.vo.ProcessTaskVO;
import org.springblade.modules.admin.dto.ErpTransferStatusDTO;
import org.springblade.modules.admin.dto.PartsWorkSaveDTO;
import org.springblade.modules.admin.entity.MaintainPartsWork;
import org.springblade.modules.admin.entity.MaintainPartsWorkSku;
import org.springblade.modules.admin.vo.PartsSimpleInfoVO;
import org.springblade.modules.admin.vo.parts.PartsWorkDetailVO;

import java.util.List;
import java.util.Map;

public interface MaintainPartsWorkService extends BaseService<MaintainPartsWork> {


	/**
	 * 用来关联获取创建人和当前的工单状态
	 * 获取申请的部件明细
	 * @param id 主键id
	 * @return 数据集
	 */
    MaintainPartsWork getDetailById(Long id);

	/**
	 * 添加部件申请记录
	 * @param partsWork
	 * @return
	 */
	Long savePartsWork(PartsWorkSaveDTO partsWork);

	/**
	 * 审批通过处理逻辑
	 * @param processPass
	 */
	void updatePartsWorkStatus(ProcessTaskVO processPass);

	/**
	 * 根据流程实例id查询申请配件工单基本信息
	 * @param processInstanceId
	 * @return
	 */
    PartsSimpleInfoVO getPartsSimpleInfo(String processInstanceId);

	/**
	 * 根据流程实例id查询申请配件工单基本信息
	 * @param planId 工单id
	 * @return
	 */
	PartsSimpleInfoVO getPartsSimpleInfoByPlanId(Long planId);

	PartsWorkDetailVO selectPartsWorkDetail(Long planId);

	Boolean updateMalRelationParts();

	/**
	 * 根据工单id查询配件信息
	 * @param planId
	 * @return
	 */
	MaintainPartsWork getByPlanId(Long planId);

	/**
	 * 已退回的数量
	 * @return 已退回的数量
	 */
    int rejectCount();

	/**
	 * ERP配件工单状态推进
	 * @param params
	 * @return
	 */
	void erpTransferStatus(ErpTransferStatusDTO params);

	Map<String, Integer> partApproveIcon();

    Boolean script(List<Long> planIds);

    List<MaintainPartsWork> selectListByPlans(List<Long> planIds);

	Boolean skuSubmit(Long planId, List<MaintainPartsWorkSku> skuList);

	/**
	 * 处理配件订单消息，伙伴云回调发送消息
	 * @param partsOrderId 配件订单id
	 */
    void processPartsOrderMessage(String partsOrderId);
}
